import request from '~/utils/request'

export default {
  /**
   * 生成订单
   * @param {*} id
   * @returns
   */
  generateOrder(id) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/trade/order/auth/generateOrder/${id}`,
      method: 'post'
    })
  },
  /**
   * 获取订单信息
   * @param {*} id
   * @returns
   */
  getOrderById(id) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/trade/order/auth//getOrderInfo/${id}`,
      method: 'post'
    })
  },
  /**
   * 判断是否课程是否购买
   * @param {*} id
   * @returns
   */
  isBuy(id) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/trade/order/auth/buyStatus/${id}`,
      method: 'post'
    })
  },
  /**
   * 获取订单列表
   * @returns
   */
  getOrderList() {
    return request({
      baseURL: "http://localhost:9110",
      url: '/service-order/api/trade/order/auth/getOrderList',
      method: 'get'
    })
  },
  /**
   * 批量删除订单
   * @param {*} idList
   * @returns
   */
  removeOrderList(idList) {
    return request({
      baseURL: "http://localhost:9110",
      url: '/service-order/api/trade/order/auth/deleteOrder',
      method: 'delete',
      data: idList
    })
  },
  /**
   * 根据id删除订单
   * @param {*} id
   * @returns
   */
  removeOrderById(id) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/trade/order/auth/deleteOrderById/${id}`,
      method: 'delete',

    })
  },
  /**
   * 买课程
   * @param {*} orderId
   * @returns
   */
  buy(orderId) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/auth/order/pay/${orderId}`,
      method: 'get',

    })
  },
  buy2(orderId) {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/auth/order/paytest/${orderId}`,
      method: 'get',

    })
  },
  payReturn() {
    return request({
      baseURL: "http://localhost:9110",
      url: `/service-order/api/auth/order/return`,
      method: 'get',

    })
  },
  /**
   * 添加交易历史记录
   * @param {*} payLog
   * @returns
   */
  payHistory(payLog) {
    return request({
      baseURL: "http://localhost:9110",
      url: "/service-order/api/auth/trade/pay/log/addLog",
      method: 'post',
      data: payLog
    })
  }
}
